package com.tinycloud.miracll.product.service.impl;

import java.util.List;
import com.tinycloud.common.core.utils.DateUtils;
import com.tinycloud.common.datasource.annotation.Slave1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tinycloud.miracll.product.mapper.ProductScheduleMainMapper;
import com.tinycloud.miracll.product.domain.ProductScheduleMain;
import com.tinycloud.miracll.product.service.IProductScheduleMainService;

/**
 * 排产主表Service业务层处理
 * 
 * @author tiny
 * @date 2022-05-28
 */
@Service
@Slave1
public class ProductScheduleMainServiceImpl implements IProductScheduleMainService {
    @Autowired
    private ProductScheduleMainMapper productScheduleMainMapper;

    /**
     * 查询排产主表
     * 
     * @param year 排产主表主键
     * @return 排产主表
     */
    @Override
    public ProductScheduleMain selectProductScheduleMainByYear(Long year) {
        return productScheduleMainMapper.selectProductScheduleMainByYear(year);
    }

    /**
     * 查询排产主表列表
     * 
     * @param productScheduleMain 排产主表
     * @return 排产主表
     */
    @Override
    public List<ProductScheduleMain> selectProductScheduleMainList(ProductScheduleMain productScheduleMain) {
        return productScheduleMainMapper.selectProductScheduleMainList(productScheduleMain);
    }

    /**
     * 查询排产主表列表 第一条
     *
     * @param productScheduleMain 排产主表
     * @return 排产主表
     */
    @Override
    public List<ProductScheduleMain> selectProductScheduleMainListTOP1(ProductScheduleMain productScheduleMain) {
        return productScheduleMainMapper.selectProductScheduleMainListTOP1(productScheduleMain);
    }

    /**
     * 新增排产主表
     * 
     * @param productScheduleMain 排产主表
     * @return 结果
     */
    @Override
    public int insertProductScheduleMain(ProductScheduleMain productScheduleMain) {
        productScheduleMain.setCreateTime(DateUtils.getNowDate());
        return productScheduleMainMapper.insertProductScheduleMain(productScheduleMain);
    }

    /**
     * 修改排产主表
     * 
     * @param productScheduleMain 排产主表
     * @return 结果
     */
    @Override
    public int updateProductScheduleMain(ProductScheduleMain productScheduleMain) {
        return productScheduleMainMapper.updateProductScheduleMain(productScheduleMain);
    }

    /**
     * 批量删除排产主表
     * 
     * @param years 需要删除的排产主表主键
     * @return 结果
     */
    @Override
    public int deleteProductScheduleMainByYears(Long[] years) {
        return productScheduleMainMapper.deleteProductScheduleMainByYears(years);
    }

    /**
     * 删除排产主表信息
     * 
     * @param year 排产主表主键
     * @return 结果
     */
    @Override
    public int deleteProductScheduleMainByYear(Long year) {
        return productScheduleMainMapper.deleteProductScheduleMainByYear(year);
    }
}
